package day1206_1;

class TH  extends  Thread{
    public void run() {
    }

    public static void main(String[] args) {
        TH  t1=new TH();
        t1.start();
    }
}







class TT  implements  Runnable{
    public void run() {
    }
}













public class Test {
    public static void main(String[] args) {
        //匿名内部类，继承Thread
        Thread  t1=new Thread(){
            public void run() {
                for (int i=1; i<10000;i++) System.out.println("做饭");
            }
        };//类 没有名字。  匿名内部类

        t1.start();


        //匿名内部类，实现了Runnable接口
        Runnable  t2=new Runnable(){
            public void run() {
                try {
                    t1.join();//让t2等待,另一个线程t1运行完毕
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("吃饭");
            }
        };

        Thread  t3=new Thread(t2);
        t3.start();










    }
}


